﻿/* 
 * author: www.cnblogs.com/luminji
 * date  : 2012/01/25
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity.Configuration;
using System.Configuration;
using Microsoft.Practices.Unity;

namespace Luminji.Core.Enterprise.Sample
{
    public class UnitySample
    {
        public static void Sample1()
        {
            using (IUnityContainer container = new UnityContainer())
            {
                UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
                section.Configure(container, "containerOne");     //无注入     
                ISomeBiz class0 = container.Resolve<ISomeBiz>("ConfigClass1");
            }
        }
    }

    public interface ISomeBiz
    {
        string GetSomething(int a);
    }

    public class SomeBiz : ISomeBiz
    {
        public string GetSomething(int a)
        {
            return (a + a).ToString();
        }
    }

}
